package cc.mxtt.mvc.service.impl;

import com.jfinal.plugin.activerecord.Page;

import cc.mxtt.mvc.model.Dept;
import cc.mxtt.mvc.model.Dict;
import cc.mxtt.mvc.service.DictService;

public class DictServiceImpl implements DictService {

	@Override
	public Dict findById(String id) {
		return Dict.dao.findById(id);
	}

	@Override
	public boolean create(Dict dict) {
		return dict.save();
	}

	@Override
	public boolean update(Dict dict) {
		return dict.update();
	}

	@Override
	public boolean delete(String id) {
		return Dept.dao.deleteById(id);
	}

	@Override
	public Page<Dict> getListDict(int pageNumber, int pageSize, String text) {
		String select = "select id,code,text,status";
		String formwhere = "from sys_dict where text like '%"+text+"%' or code like '%"+text+"%'";
		return Dict.dao.paginate(pageNumber, pageSize, select, formwhere);
	}

}
